import java.util.*;
public class Main4
{
    public static void main(String[] args)
    {
        Scanner cin = new Scanner(System.in);

        int n = cin.nextInt();
        int pass[] = new int[n];
        int fail[] = new int[n];
        int passNum =0,failNum =0;
        for(int i =0;i<n;i++)
        {
            int tmp = cin.nextInt();
            if(tmp<60)
                fail[failNum++] = tmp;
            else
                pass[passNum++] = tmp;
        }

        System.out.println("Pass="+passNum);
        if(passNum==0)
            System.out.print("-");
        else
        for(int i =0;i<passNum;i++)
        {
            System.out.print(pass[i]);
            if(i!=passNum-1)
                System.out.print(",");
        }

        System.out.println("\n"+"Fail="+failNum);
        if(failNum==0)
            System.out.print("-");
        else
        for(int i =0;i<failNum;i++)
        {
            System.out.print(fail[i]);
            if(i!=failNum-1)
                System.out.print(",");
        }
        cin.close();
    }
}
